import {Card} from "antd";
import RecentlySearch from "@/components/recently/RecentlySearch.tsx";
import RecentlyTable from "@/components/recently/RecentlyTable.tsx";
import {useRef, useState} from "react";

interface IProps {
    getList: () => void
}

const RecentlyList = () => {
    const [name, setName] = useState<string>('')
    const recentlyTableRef = useRef()
    const getList = () => {
        if (recentlyTableRef.current) {
            (recentlyTableRef.current as IProps).getList()
        }
    }
    return (
        <Card title={<RecentlySearch setName={setName} getList={getList} />}>
            <RecentlyTable ref={recentlyTableRef} name={name} />
        </Card>
    )
}

export default RecentlyList